<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>计算两数之和</title>
</head>

<body>
    <h1>两数相加的结果为:</h1>
    <h1 id="result1"></h1>

    <script>
        var num1 = prompt("请输入第一个数字:");
        var num2 = prompt("请输入第二个数字:");
        var sum = parseFloat(num1) + parseFloat(num2);
        var result1 = document.getElementById("result1");
        result1.innerText = num1 + " + " + num2 + " = " + sum;
    </script>
</body>

</html>